package org.liulinlin.sejw.db;

import java.sql.*;

public class RouteRequest { //extends DataAccessServiceImpl {
	private int id;
	private int direct;
	private String transit;
	private int transport;
	
	public RouteRequest() {
		
	}
	public RouteRequest(int id) {
		DBConnectionManager connMgr = DBConnectionManager.getInstance();
		Connection con = connMgr.getConnection("shipping_export");
		if (con == null) {
			System.out.println("不能获得数据库连接");
			return;
		}
		
		try {
			Statement stmt = con.createStatement();
			ResultSet rs = stmt.executeQuery("select * from RouteRequest where RR_ID = '" + id + "'");
		
			rs.next();
			this.id = id;
			direct = rs.getInt("RR_Direct");
			if (direct == 2) {					//中转
				transit = rs.getString("RR_Transit");
			}
			transport = rs.getInt("RR_Transport");
		
			rs.close();
			stmt.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		connMgr.freeConnection("shipping_export", con);
		connMgr.release();
	}
	
	public void setId(int id) {
		this.id = id;
	}
	public void setDirect(int direct) {
		this.direct = direct;
	}
	public void setTransit(String transit) {
		this.transit = transit;
	}
	public void setTransport(int transport) {
		this.transport = transport;
	}
	
	public int getId() {
		return id;
	}
	public int getDirect() {
		return direct;
	}
	public String getTransit() {
		return transit;
	}
	public int getTransport() {
		return transport;
	}
}
